The technology described herein relates to computer graphics processing, and in particular to the processing of graphics primitives when generating a render output in a computer graphics processing system.
Graphics processing is normally carried out by first splitting the desired render output, e.g. the frame to be displayed, into a number of similar basic components or “primitives”, which primitives are then subjected to the desired graphics processing operations. The graphics primitives are usually in the form of simple polygons, such as triangles or quadrilaterals.
Each primitive is usually defined by and represented as a set of vertices. Each vertex for a primitive has associated with it a set of data (such as position, colour, texture and other attributes data) representing the vertex. This data is then used, e.g., when rasterising and rendering the primitive(s) to which the vertex relates, e.g. for display.
Once primitives and their vertices have been generated and defined, they can be processed by the graphics processing system, in order, e.g., to render the frame. This process basically involves determining which sampling positions of an array of sampling positions covering the output area to be processed are covered by a primitive, and then determining the appearance that each sampling point should have (e.g. in terms of its colour, etc.) to represent the primitive at that sampling position. These processes are commonly referred to as rasterising and rendering, respectively.
The rasterising process typically determines the sampling points that should be used for a primitive (i.e. the (x, y) sampling positions for sampling points to be used to represent the primitive in the render output, e.g. frame to be displayed).
The rendering process then derives the data, such as red, green and blue (RGB) colour values and an “Alpha” (transparency) value, necessary to represent the primitive at the sampling positions (i.e. “shades” each sampling point). This can involve applying textures, blending sampling point data values, etc.
In 3D graphics literature, the term “rasterisation” is sometimes used to mean both primitive conversion to sampling points and rendering. However, herein “rasterisation” will be used to refer to converting primitive data to sampling point addresses only.
The rasterisation process basically maps the primitives defining the render output to be generated to the sampling points that will be used to render the output. This is typically done by determining, for each sampling point, whether the sampling point position is covered by the primitive in question or not. This determination is typically done by testing the sampling points' positions against the edges of the primitive, to see if the sampling points are covered by the primitive. To do this, graphics processing systems typically derive (line) equations representing each of the edges of a primitive (e.g. using the defined vertices of the primitive), and then test the sampling points' positions using these edge equations. If a sampling point “passes” the edge test, it is taken to be within the primitive.
The rasterisation process is typically carried out by testing sets of one or more sampling points. For each set of one or more sampling points found to include a sampling point that is covered by the primitive in question (being tested), a discrete graphical entity usually referred to as a graphics “fragment”, on which the subsequent graphics processing operations (such as rendering) are to be carried out, is then generated by the rasteriser and sent to the rest of the graphics processing pipeline (such as the renderer) for processing.
One drawback of current graphics processing systems is that because primitives are processed sequentially, and typically not in perfect front-to-back order, a given sampling position (and hence pixel(s)) may be shaded multiple-times as an output is processed, e.g. for display. This occurs when a first received and rendered primitive is later covered by a subsequently received and rendered primitive, such that the rendered first primitive is not in fact seen at the sampling position(s) (and pixel(s)) in question. Primitives can be overwritten many times in this manner and this typically leads to multiple, ultimately redundant, graphics processing (rendering) operations being carried out for each render output, e.g. frame, being rendered. This phenomenon is commonly referred to as “overdraw”.
A number of techniques have therefore been proposed to try to reduce the amount of “overdraw” (the amount of redundant processing of hidden surfaces) that is performed when processing a render output, such as a frame for display (i.e. to avoid rendering non-visible primitives and/or fragments, etc.).
For example, forms of hidden surface removal may be carried out before a primitive and/or fragment is sent for rendering, to see if the primitive or fragment etc. will be obscured by a primitive that has already been rendered (in which case the new primitive and/or fragment need not be rendered). Such hidden surface removal may comprise, for example, early occlusion culling, such as early depth (Z) and/or stencil (S) testing processes. These arrangements try to identify, e.g., sampling points for a new primitive that will be occluded by already processed primitives (and therefore that do not need processing) before the sampling points are issued to the rendering pipeline. In these arrangements, the depth value, e.g., of a new primitive to be rasterised at the sampling position(s) in question is compared to the current depth values for the sampling position(s) in a depth buffer to see if the new primitive is occluded at the sampling position(s) in question or not. This can help to avoid sending fragments that are occluded by already processed primitives through the rendering pipeline.
For another example, other forms of hidden surface removal developed by the Applicant may be carried out after primitives and/or fragments are sent for rendering. These arrangements may try to identify, e.g., sampling points for a primitive and/or fragment currently being processed that will be occluded by a newly received primitive. In these arrangements, the depth value, e.g., of a newly received primitive to be rasterised at the sampling position(s) in question may be compared to the current depth values for the sampling position(s) in a depth buffer to see if the newly received primitive will result in overdraw at the sampling position(s) in question or not. A “forward pixel kill” signal may then be sent to one or more later stages of the graphics processing pipeline. This can help to reduce the amount of further processing of fragments for primitives that will eventually be overdrawn by newly received primitives that enter the rendering pipeline by discarding or “killing” those fragments at a later stage of the graphics processing pipeline.
The Applicants believe there remains scope for improvements in processing graphics primitives when generating a render output in a graphics processing system.